<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div id="app"></div>

    <template id="my-app">
      <!-- 1.lazy修饰符的作用是将绑定事件 input事件 切换为 change事件 -->
      <!-- <input type="text" v-model.lazy='message'> -->

      <!-- 
			2.number修饰符
			type为text的value值是字符串类型，可以通过number修饰符转成number类型
			设置number修饰符后只会提取数字，碰到字符串会截掉后面的值
		 -->
      <!-- <input type="text" v-model.number='message'>
		<h2>{{message}}</h2>
		<button @click='showType'>查看类型</button> -->

      <!-- 3.trim修饰符的作用是将两边空格去除 -->
      <input type="text" v-model.trim="message" />
      <button @click="showResult">显示结果</button>
    </template>

    <script src="../js/Vue.js"></script>
    <script>
      const app = {
        template: '#my-app',
        data() {
          return {
            message: 'Hello World'
          }
        },
        methods: {
          showType() {
            console.log(this.message, typeof this.message)
          },
          showResult() {
            console.log(this.message)
          }
        }
      }

      Vue.createApp(app).mount('#app')
    </script>
  </body>
</html>
